﻿<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
	<meta charset="utf-8" />
    <script src="../js/jquery-1.8.3.min.js"></script>
    <script type="text/javascript">
        $(function () {
            //测试调用LoggeryHandler.ashx
            $("#InitPool").click(function () {
                $.get("GetHandler.ashx", { "action": "InitPool" }, function (data) {
                    //alert(data.Data);
                    console.log(data.Data);
                })
            })
            $("#DrawPrize").click(function () {
                $.post("Posthandler.ashx", { "action": "Lottery", "openId": "oiz3Mvrq3Z4AVAyBSHusrpVRZtcM" },
                    function (data) {
                    console.log(data.Data);
                })
            })

            $("#Add").click(function () {
                $.post("Posthandler.ashx", { "action": "Add", "CardID": "KM0000027427", "CardCode": "1110018261", "ShopID": "KM000049" },
                    function (data) {
                        console.log(data.Data);
                    })
            })

            $("#List").click(function () {
                $.post("Posthandler.ashx", { "action": "LotteryList", "openId": "oiz3Mvrq3Z4AVAyBSHusrpVRZtcM" },
                    function (data) {
                        $("#msg").empty();
                        var r = "";
                        var d = data.Data;
                        $.each(d,function (i) {
                            r += "奖品:<span>" + d[i].ProductType + "</span>   时间:<span>" + d[i].CreateDate + "</span></br>"
                        });
                    
                        $("#msg").append(r);
                    })
            })
            $("#startFuc").click(function () {
                var d = new Date();
                var day = d.getDate();
                var hour = d.getHours();
               
                var i = setInterval(StartFun, 5000); //86400000:24小时  108000000:30小时
               
            })
            function StartFun() {
                //$.get("GetHandler.ashx", { "action": "InitPool" }, function (data) {
                //    alert(data.Data);
                //   // console.log(data.Data);
                //})
                console.log("I:");
            }
        })

    </script>
</head>
<body>
    <button  id="InitPool">初始化奖池</button>

    <button id="DrawPrize">抽奖</button>

    <button id="Add">添加积分</button>

    <button id="List">中奖列表</button>

    <button id="startFuc">启动->初始化奖池</button>
    <div id="msg"></div>
</body>
</html>
